package cn.hxzy.service;

import cn.hxzy.dao.MemberDao;
import cn.hxzy.entity.Member;
import cn.hxzy.entity.vo.PageObj;

import java.util.List;

public class MemberService {
    MemberDao memberDao = new MemberDao();

    public List<Member> findAll() throws Exception {
        return memberDao.findAll();

    }
    public PageObj<Member> findAll(PageObj<Member> page) throws Exception {
        List<Member> all = memberDao.findAll(page.getPage(), page.getSize());
        page.setList(all);
        long count = memberDao.countAll();
        page.setCount(count);
        Integer size = page.getSize();
        long l = count % size != 0 ? (count / size) + 1 : (count / size);
        page.setPageCount((int) l);
        return page;

    }

}
